
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:th="http://www.thymeleaf.org"
	xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
	layout:decorator="main">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>上传题库文件</title>
<link href="css/bootstrap3.css" rel="stylesheet" type="text/css" />
<link href="/css/bootstrap-fileinput/fileinput.css" rel="stylesheet"
	type="text/css" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/bootstrap3.js"></script>
<!-- sortable plugin for sorting/rearranging initial preview -->
<script src="/js/bootstrap-fileinput/plugins/sortable.min.js"></script>
<!-- purify plugin for safe rendering HTML content in preview -->
<script src="/js/bootstrap-fileinput/plugins/purify.min.js"></script>
<script type="text/javascript"
	src="/js/bootstrap-fileinput/fileinput.js"></script>
<script type="text/javascript"
	src="/js/bootstrap-fileinput/locales/zh.js"></script>
</head>
<body layout:fragment="content">
	<div class="place">
		<span>位置：</span>
		<ul class="placeul">
			<li><a href="/ordering/home">首页</a></li>
			<li><a href="#">上传题库文件</a></li>
		</ul>
	</div>
	<div class="file-loading">
		<input id="questionExcel" name="questionExcel" type="file"
			class="file" data-browse-on-zone-click="true" />
	</div>
	<br />

	<script type="text/javascript">
	 /* //初始化Excel导入的文件
    function InitExcelFile() {
       
        $("#questionExcel").fileinput({
            uploadUrl: "/uploadQuestionExcelFile", // 上传的地址
            uploadAsync: true,              // 异步上传
            language: "zh",                 // 设置语言
            showCaption: true,              // 是否显示标题
            showUpload: true,               // 是否显示上传按钮
            showRemove: true,               // 是否显示移除按钮
            showPreview : true,             // 是否显示预览按钮
            browseClass: "btn btn-primary", // 按钮样式 
            dropZoneEnabled: false,         // 是否显示拖拽区域
            allowedFileExtensions: ["xls", "xlsx"], // 接收的文件后缀
            maxFileCount: 1,                        // 最大上传文件数限制
      
        });  //文件上传完成后的事件
	} */
	$("#questionExcel").fileinput({
	    uploadUrl: "/uploadQuestionExcelFile",
	    uploadAsync: false,				//1异步上传
	    language: "zh",                 // 设置语言
	    minFileCount: 1,
	    maxFileCount: 1,
	    overwriteInitial: false,
	    browseOnZoneClick: true ,
	    browseClass: "btn btn-primary",    //按钮样式
	    allowedFileExtensions: ["xls", "xlsx"], // 接收的文件后缀
	    initialPreviewAsData: true ,
	    previewFileIcon: '<i class="glyphicon glyphicon-file"></i>',
	    showPreview: true, //是否显示预览
	  /*   previewFileIconSettings: {
	    	'xlsx': '<i class="fa fa-file-excel-o text-success"></i>',
            'xls': '<i class="fa fa-file-excel-o text-success"></i>'
	    } */
	}).on('filesorted', function(e, params) {
	    console.log('File sorted params', params);
	}).on('fileuploaded', function(e, params) {
	    console.log('File uploaded params', params);
	    alert(params.response.status)
	}).on('filebatchpreupload', function(event, data) {
        var n = data.files.length, files = n > 1 ? n + ' files' : 'one file';
        if (!window.confirm("Are you sure you want to upload " + files + "?")) {
            return {
                message: "Upload aborted!", // upload error message
                data:{} // any other data to send that can be referred in `filecustomerror`
            };
        }
    }).on("filepredelete", function(jqXHR) {
        var abort = true;
        if (confirm("Are you sure you want to delete this image?")) {
            abort = false;
        }
        return abort; // you can also send any data/object that you can receive on `filecustomerror` event
    });
	</script>

</body>
</html>
<!-- <button type = "button" class = "btn btn-primary" data-toggle = "modal" data-target = "#import" >    
	  启动模态
	</button>
	导入数据操作层
<div id="import" class="modal fade bs-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="false">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header bg-primary">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                <h4 class="modal-title">文件导入</h4>
            </div>
            <div class="modal-body">
                <div style="text-align:right;padding:5px">
                    <a href="~/Content/Template/TestUser-模板.xls" onclick="javascript:Preview();">
                        <img alt="测试用户信息-模板" src="~/Content/images/ico_excel.png" />
                        <span style="font-size:larger;font-weight:200;color:red">TestUser-模板.xls</span>
                    </a>
                </div>
                <hr/>
                <form id="ffImport" method="post">
                    <div title="Excel导入操作" style="padding: 5px">
                        <input type="hidden" id="AttachGUID" name="AttachGUID" /> 
                        <input id="excelFile" type="file"> 
                    </div>
                </form>

                数据显示表格
                <table id="gridImport" class="table table-striped table-bordered table-hover" cellpadding="0" cellspacing="0" border="0">
                </table>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" onclick="SaveImport()">保存</button>
            </div>
        </div>
    </div>
</div> -->